using System;

public partial class Pager : System.Web.UI.UserControl
{
    private int itemsCount;
    private int pageSize;
    private string url;
    private int number = 1;

    public int ItemsCount
    {
        get { return itemsCount; }
        set { itemsCount = value; }
    }

    public int PageSize
    {
        get { return pageSize; }
        set { pageSize = value; }
    }

    public string Url
    {
        get { return url; }
        set { url = value; }
    }

    public int Number
    {
        get
        {
            return number++;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            int pagesCount = (itemsCount/pageSize) + 1;
            string [] links = new string[pagesCount];
            if (pagesCount > 1)
            {
                for (int i = 0; i < pagesCount; i++)
                {
                    links[i] = String.Format(url, i);
                }
                naviRepeater.DataSource = links;
                naviRepeater.DataBind();
            }
        }
    }
}
